<!--
 * @Author: Neko
 * @Date: 2021-04-09 10:21:33
 * @LastEditTime: 2021-06-16 17:49:39
 * @LastEditors: Neko
-->
<template>
	<view class="search_component" >
		<u-gap height="8"></u-gap>
		<view class="search_acitve" @click="navSwitch('/pages/index/search/index?getHot=1')">
			<u-icon name="search" color="#888" size="26"></u-icon>
			<text class="placeholder">{{value[0].word}}</text>
		</view>
		<u-gap height="8"></u-gap>
	</view>
</template>

<script>
import { isWechatBrowser } from '@/util'
import { getKeywordInfo } from '@/api/http/home'
export default {
	props: {
		value: {
			type: [Object, Array],
			default: () => [{word: 'search'}]
		}
	},
	data() {
		return {
			
		}
	},
	created() {
	},
	methods: {
		// 调用扫码
		scanCode() {
			/*
			 *    uinapp扫码api 不支持H5 ⬇️ 过滤掉H5
			 */

			// #ifndef H5
			uni.scanCode({
				success: res => {
					console.log(res)
					console.log('条码内容：' + res.result)
				}
			})
			// #endif

			/*
			 *    H5调用微信浏览器的扫码功能 首先判断是否微信浏览器打开
			 */
			// #ifdef H5
			if (isWechatBrowser()) {
				
			} else {
				uni.showToast({
					icon: 'none',
					title: this.$t('locales.pleaseLinkWechat')
				});
			}
			// #endif
		},
		
		navSwitch(url) {
			uni.navigateTo({
				url
			})
		},
	}
}
</script>

<style lang="scss" scoped>
.search_component {
	// padding: 0 24rpx;
	box-sizing: border-box;
	margin: 0 24rpx;
	.search_acitve {
		flex: 1;
		background-color: #FFFFFF;
		height: 60rpx;
		color: #888;
		border-radius: 30rpx;
		box-sizing: border-box;
		padding: 0 30rpx;
		display: flex;
		align-items: center;
		.placeholder {
			display: inline-block;
			margin-left: 20rpx;
			font-size: 26rpx;
		}
	}
	.code_btn {
		width: 60rpx;
		height: 60rpx;
		background-image: url(@/static/iconImg/scan_code.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
		margin-left: 20rpx;
	}
}
</style>
